home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / t3_1 / risc_src.lha / risc_sources / scheme / system.t < prev   
Text File  |  1989-06-30  |  3KB  |  78 lines

  1. (herald system (env tsys))
  2.  
  3. ;;; Copyright (c) 1985 Yale University
  4. ;;;     Authors: N Adams, R Kelsey, D Kranz, J Philbin, K Pitman, J Rees.
  5. ;;; This material was developed by the T Project at the Yale University Computer
  6. ;;; Science Department.  Permission to copy this software, to redistribute it,
  7. ;;; and to use it for any purpose is granted, subject to the following restric-
  8. ;;; tions and understandings.
  9. ;;; 1. Any copy made of this software must include this copyright notice in full.
  10. ;;; 2. Users of this software agree to make their best efforts (a) to return
  11. ;;;    to the T Project at Yale any improvements or extensions that they make,
  12. ;;;    so that these may be included in future releases; and (b) to inform
  13. ;;;    the T Project of noteworthy uses of this software.
  14. ;;; 3. All materials developed as a consequence of the use of this software
  15. ;;;    shall duly acknowledge such use, in accordance with the usual standards
  16. ;;;    of acknowledging credit in academic research.
  17. ;;; 4. Yale has made no warranty or representation that the operation of
  18. ;;;    this software will be error-free, and Yale is under no obligation to
  19. ;;;    provide any services, by way of maintenance, update, or otherwise.
  20. ;;; 5. In conjunction with products arising from the use of this material,
  21. ;;;    there shall be no use of the name of the Yale University nor of any
  22. ;;;    adaptation thereof in any advertising, promotional, or sales literature
  23. ;;;    without prior written consent from Yale in each case.
  24. ;;;
  25.  
  26. ;;; Modified by Ashwin Ram, July 1985
  27.  
  28. (import t-implementation-env source-file-extension)
  29.  
  30. (define (scheme-breakpoint)
  31.   (bind (((repl-prompt) scheme-prompt)
  32.      ((source-file-extension) 'scm)
  33.          ((repl-print)  scheme-repl-print))
  34.     (breakpoint "Scheme" scheme-env)))
  35.  
  36. (define (scheme-top-level)
  37.   (bind (((repl-prompt) scheme-prompt)
  38.          ((repl-print)  scheme-repl-print)
  39.      ((source-file-extension) 'scm)
  40.          ((repl-env)    scheme-env))
  41.     (breakpoint "Scheme Top Level" scheme-env)))
  42.  
  43. (define (scheme-reset)
  44.   (set (*value t-implementation-env '*top-level*) scheme-top-level)
  45.   ((*value t-implementation-env '**reset**) nil))
  46.  
  47. (*define scheme-env   'reset (*value scheme-internal-env 'scheme-reset))
  48. (*define standard-env 'scheme-reset (*value scheme-internal-env 'scheme-reset))
  49. (*define scheme-env   't-reset (*value t-implementation-env 't-reset))
  50.  
  51. (define scheme-prompt
  52.    (lambda (n)
  53.      (if (<= n 0)
  54.          "==> "
  55.          (format nil "[~s]=> " n))))
  56.  
  57. ;; Ignore the fact that the MIT dialect does newline-before-print instead of
  58. ;; newline-after-print.  Instead, try to put a blank line between the print
  59. ;; and the next prompt, so that it looks more like the output in SICP.
  60.  
  61. (define (scheme-repl-print obj port)
  62.    (print obj port)
  63.    (fresh-line port)
  64.    (newline port))
  65.  
  66. (define (scheme-repl-eval exp env)              ;; not currently used
  67.   (eval (scheme-preprocess-form exp) env))
  68.  
  69. (define (scheme-preprocess-form exp)
  70.    (cond ((definition? exp)
  71.           (receive (name val) (parse-define (cadr exp) (cddr exp))
  72.              `(,(t-syntax 'define) ,name ,val)))
  73.          (else exp)))
  74.  
  75. ;;****************************************************************************
  76. 'SCHEME_SYSTEM
  77.  
  78.